package com.atguigu.srb.oss.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Configuration
@ConfigurationProperties(prefix = "aliyun.oss")
@Data
public class OSSProperties {
    private String endpoint;
    private String bucketName;
    private String accessKeyId;
    private String accessKeySecret;
    private String domainName;

    public static String END_POINT;
    public static String BUCKET_NAME;
    public static String ACCESS_KEY_ID;
    public static String ACCESS_KEY_SECRET;
    public static String DOMAIN_NAME;
    @PostConstruct//注解的方法会在Bean的属性被容器设置之后，且Bean被初始化之前被调用
    public void init(){
        END_POINT = endpoint;
        BUCKET_NAME = bucketName;
        ACCESS_KEY_ID = accessKeyId;
        ACCESS_KEY_SECRET = accessKeySecret;
        DOMAIN_NAME = domainName;
    }
}